class mathMulMod extends Mod
{
  mathMulMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="mul";
    loadImg(img);
    name="";
    minWx=24;
    minWy=48;
    iPs[ip]=new inPort(this, 2, "");
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "");
    updatePorts();
    iPs[1].setShowUnused(true);
    iPs[1].setAddPort(true);
  }
  void go() {   
    sendFloat(iPs[0].floatV*iPs[1].floatV, 0);
  }
}
class mathDivMod extends Mod
{
  mathDivMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="div";
    loadImg(img);
    name="";
    minWx=24;
    minWy=40;
    iPs[ip]=new inPort(this, 2, "");
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "");
    updatePorts();
  }
  void go() {
    if (iPs[1].floatV!=0) {
      sendFloat(iPs[0].floatV/iPs[1].floatV, 0);
      sendString(null, 0);
    }
    else {
      sendString("nan", 0);
    }
  }
}
class mathAddMod extends Mod
{
  mathAddMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="add";
    loadImg(img);
    name="";
    minWx=24;
    minWy=40;
    iPs[ip]=new inPort(this, 2, "");
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "");
    updatePorts();
    iPs[1].setAddPort(true);
  }
  void go() {
    sendFloat(iPs[0].floatV+iPs[1].floatV, 0);
  }
}

class mathSubMod extends Mod
{
  mathSubMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="sub";
    loadImg(img);
    name="";
    minWx=24;
    minWy=40;
    iPs[ip]=new inPort(this, 2, "");
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "");
    updatePorts();
  }
  void go() {
    sendFloat(iPs[0].floatV-iPs[1].floatV, 0);
  }
}

class mathAbsMod extends Mod
{
  mathAbsMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="abs";
    loadImg(img);
    name="";
    minWx=30;
    minWy=24;
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "");
    updatePorts();
  }
  void go() {
    sendFloat(abs(iPs[0].floatV), 0);
  }
}
class mathModMod extends Mod
{
  mathModMod(Mod tempParent, float tempBx, float tempBy, int tempIndex) {
    super(tempParent, tempBx, tempBy, tempIndex);
    img="mod";
    loadImg(img);
    name="";
    minWx=24;
    minWy=40;
    iPs[ip]=new inPort(this, 2, "");
    iPs[ip]=new inPort(this, 2, "");
    oPs[op]=new outPort(this, 2, "div");
    oPs[op]=new outPort(this, 2, "rem");
    updatePorts();
  }
  void go() {
    sendFloat((float)floor(iPs[0].floatV/iPs[1].floatV), 0);
    sendFloat(iPs[0].floatV%iPs[1].floatV, 1);
  }
}
